<template>
	<view>
		<detail-main :model="model" :type="type" @add-click = "addClick1"></detail-main>
	</view>
</template>

<script>
	import detailMain from "../../components/detail-main/detail-main.vue";
	export default {
		comments: {
			detailMain
		},
		data() {
			return {
				model: {
					c_id: '',
					c_name: '',
					c_sex: '',
					c_phone: '',
					c_address: '',
					c_age: ''
				},
				type:'新增'
			}
		},
		methods: {
			addClick1(model) {
				
		console.log(model)
			uni.request({
				url: `${this.apiUrl}/rest/ad/`,
				method: 'POST',
				data: {
			
					...this.model
				},
				success: (res) => {
					console.log(res)
					if (res.data.code === 200) {
						uni.showToast({
							title: res.data.message,
							icon: 'success'
						})
					}
				},
				fail: () => {
		
				},
				complete: () => {
		
				}
			})		
			},
		}
	}
</script>

<style>

</style>
